package com.lmb.service.impl;

import com.lmb.bean.Subsidies;
import com.lmb.mapper.SubsidiesDao;
import com.lmb.service.SubsidiesService;
import com.lmb.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SubsidiesServiceImpl implements SubsidiesService {
    @Autowired
    SubsidiesDao subsidiesDao;

    @Override
    public Subsidies add(Subsidies subsidies) {
        subsidiesDao.add(subsidies);
        Subsidies result=subsidiesDao.one(subsidies.getSubsidy_id());
        return result;
    }

    @Override
    public Subsidies edit(Subsidies subsidies) {
        subsidiesDao.edit(subsidies);
        Subsidies result=subsidiesDao.one(subsidies.getSubsidy_id());
        return result;
    }

    @Override
    public int del(Integer id) {
        return subsidiesDao.del(id);
    }

    @Override
    public Subsidies one(Integer id) {
        return subsidiesDao.one(id);
    }

    @Override
    public List<Subsidies> all(Subsidies subsidies) {

        return subsidiesDao.all(subsidies);
    }

    @Override
    public void page(Page page, Subsidies subsidies) {
        int count= subsidiesDao.pageCount(subsidies);
        Object data= subsidiesDao.page(page, subsidies);
        page.setCount(count);
        page.setData(data);
    }
}
